﻿using System;
using System.Windows;

namespace NanoMvvm
{
    public class ApplicationViewModel : SoftwareModuleViewModel
    {
        private string header;

        public ApplicationViewModel(Application app)
        {
            App = app;

            if (RunModeResolver.InDesignMode)
            {
                return;
            }

            if (app == null)
            {
                throw new ArgumentNullException("app");
            }

            ShutdownCommand = new CommandViewModel<DelegateCommand>("Exit", new DelegateCommand(app.Shutdown));
        }

        public Application App { get; private set; }

        public string Header
        {
            get { return header; }
            set { SetProperty(ref header, value, () => Header); }
        }

        public CommandViewModel<DelegateCommand> ShutdownCommand { get; private set; }
    }
}